<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>ActiveSupport::Deprecation::MethodWrapper</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/github.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Module</span> 
            ActiveSupport::Deprecation::MethodWrapper 
            
        </h1>
        <ul class="files">
            
            <li><a href="../../../files/activesupport/lib/active_support/deprecation/method_wrappers_rb.html">activesupport/lib/active_support/deprecation/method_wrappers.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>D</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="MethodWrapper.html#method-i-deprecate_methods">deprecate_methods</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    


    


    <!-- Methods -->
        
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-deprecate_methods">
            
              <b>deprecate_methods</b>(target_module, *method_names)
            
            <a href="MethodWrapper.html#method-i-deprecate_methods" name="method-i-deprecate_methods" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Declare that a method has been deprecated.</p>

<pre class="ruby"><span class="ruby-keyword">module</span> <span class="ruby-constant">Fred</span>
  <span class="ruby-identifier">extend</span> <span class="ruby-keyword">self</span>

  <span class="ruby-keyword">def</span> <span class="ruby-identifier">foo</span>; <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">bar</span>; <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">baz</span>; <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>

<span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Deprecation</span>.<span class="ruby-identifier">deprecate_methods</span>(<span class="ruby-constant">Fred</span>, :<span class="ruby-identifier">foo</span>, <span class="ruby-identifier">bar</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">qux</span>, <span class="ruby-identifier">baz</span><span class="ruby-operator">:</span> <span class="ruby-string">'use Bar#baz instead'</span>)
<span class="ruby-comment"># =&gt; [:foo, :bar, :baz]</span>

<span class="ruby-constant">Fred</span>.<span class="ruby-identifier">foo</span>
<span class="ruby-comment"># =&gt; &quot;DEPRECATION WARNING: foo is deprecated and will be removed from Rails 4.1.&quot;</span>

<span class="ruby-constant">Fred</span>.<span class="ruby-identifier">bar</span>
<span class="ruby-comment"># =&gt; &quot;DEPRECATION WARNING: bar is deprecated and will be removed from Rails 4.1 (use qux instead).&quot;</span>

<span class="ruby-constant">Fred</span>.<span class="ruby-identifier">baz</span>
<span class="ruby-comment"># =&gt; &quot;DEPRECATION WARNING: baz is deprecated and will be removed from Rails 4.1 (use Bar#baz instead).&quot;</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-deprecate_methods_source')" id="l_method-i-deprecate_methods_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/b955939d55b71905fa3e5036149ee4c84943c599/activesupport/lib/active_support/deprecation/method_wrappers.rb#L28" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-deprecate_methods_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/deprecation/method_wrappers.rb, line 28</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">deprecate_methods</span>(<span class="ruby-identifier">target_module</span>, *<span class="ruby-identifier">method_names</span>)
  <span class="ruby-identifier">options</span> = <span class="ruby-identifier">method_names</span>.<span class="ruby-identifier">extract_options!</span>
  <span class="ruby-identifier">deprecator</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:deprecator</span>) <span class="ruby-operator">||</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Deprecation</span>.<span class="ruby-identifier">instance</span>
  <span class="ruby-identifier">method_names</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">keys</span>

  <span class="ruby-identifier">method_names</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method_name</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">target_module</span>.<span class="ruby-identifier">alias_method_chain</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-value">:deprecation</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">target</span>, <span class="ruby-identifier">punctuation</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">target_module</span>.<span class="ruby-identifier">send</span>(<span class="ruby-value">:define_method</span>, <span class="ruby-node">&quot;#{target}_with_deprecation#{punctuation}&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span>*<span class="ruby-identifier">args</span>, &amp;<span class="ruby-identifier">block</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">deprecator</span>.<span class="ruby-identifier">deprecation_warning</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">options</span>[<span class="ruby-identifier">method_name</span>])
        <span class="ruby-identifier">send</span>(<span class="ruby-value">:&quot;#{target}_without_deprecation#{punctuation}&quot;</span>, *<span class="ruby-identifier">args</span>, &amp;<span class="ruby-identifier">block</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    